from base.base import Base
from loc.login_page_locators import LoginPageLocators


class PageLogin:
    def __init__(self, driver):
        self.driver = driver
        self.base = Base(driver)

    def login(self, username, password):
        self.base.input_text(LoginPageLocators.USERNAME, username)
        self.base.input_text(LoginPageLocators.PASSWORD, password)
        self.base.click(LoginPageLocators.LOGIN_BUTTON)

    def get_login_success_result(self):
        return self.base.get_text(LoginPageLocators.SUCCESS_MESSAGE)

    def get_login_user_err_result(self):
        return self.base.get_text(LoginPageLocators.USERNAME_ERROR)

    def get_login_pwd_err_result(self):
        return self.base.get_text(LoginPageLocators.PASSWORD_ERROR)
